package com.ww.springboot.boot.controller;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述：
 *
 * @author wanwei
 * @since 2021-08-13 14:13
 */
@RestController
@RequestMapping("common")
@AllArgsConstructor
public class CommomController {

    private static Integer num = 0;

    private static String str = "0";

    private static Map<String, String> map = new HashMap<>();

    @RequestMapping("int")
    public String find(int num) {
        System.out.println("--------初始----------");
        System.out.println(this.num);
        this.num = num;
        System.out.println("------------------");
        System.out.println(this.num);
        return "";
    }

    @RequestMapping("string")
    public String find(String str) {
        System.out.println("--------初始----------");
        System.out.println(this.str);
        this.str = str;
        System.out.println("------------------");
        System.out.println(this.str);
        return "";
    }

    @RequestMapping("map")
    public String find(String key, String value) {
        System.out.println("--------初始----------");
        System.out.println(map.get(key));
        map.put(key, value);
        System.out.println("------------------");
        System.out.println(map.get(key));
        return "";
    }


}
